package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author hua
 * @since 2024-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_product_stock_rack")
@NoArgsConstructor
public class ProductStockRackDo extends Model<ProductStockRackDo> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 库存主表id
     */
    @TableField("stock_id")
    private Long stockId;

    /**
     * 库位id
     */
    @TableField("rack_id")
    private Long rackId;

    /**
     * 库存属性
     */
    @TableField("stock_attribute")
    private Integer stockAttribute;

    /**
     * 接收数量
     */
    @TableField("received_qty")
    private Integer receivedQty;

    /**
     * 可用库存
     */
    @TableField("quantity")
    private Integer quantity;

    /**
     * 锁定库存
     */
    @TableField("lock_quantity")
    private Integer lockQuantity;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(value = "create_by_name", fill = FieldFill.INSERT)
    private String createByName;

    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

//    @Version
//    private Integer version;

    public ProductStockRackDo(Long stockId, Long rackId, Integer stockAttribute, Integer receivedQty, Integer quantity) {
        this.stockId = stockId;
        this.rackId = rackId;
        this.stockAttribute = stockAttribute;
        this.receivedQty = receivedQty;
        this.quantity = quantity;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
